home *** CD-ROM | disk | FTP | other *** search
- // GETINFO SCRIPTING
- // ErreursDeFilms.com - Recherche d'erreurs dans des films - by ScorEpioN
-
- (***************************************************
- * Script d'importation pour : *
- * ErreursDeFilms , www.erreursdefilms.com *
- * *
- * Script by ScorEpioN *
- * *
- * Version : 7 - Update du 31/10/2004 *
- * *
- * A utiliser avec Ant Movie Catalog 3.4.0 *
- * www.ant.be.tf/moviecatalog ╖╖╖ www.buypin.com *
- * *
- * The source code of the script can be used in *
- * another program only if full credits to *
- * script author and a link to Ant Movie Catalog *
- * website are given in the About box or in *
- * the documentation of the program *
- ***************************************************)
-
- program ErreurDeFilm_SEARCH;
-
- const
- ConfirmTitre = True;
- { True: Demande le titre avant de lancer le script
- False: Ne demande pas le titre avant de lancer le script }
- var
- MovieName, NomFilm, Adresse, Parametre, Reponse : string;
- premiereExecution : Integer;
-
- //------------------------------------------------------------------------------
- // ANALYSE DE LA PAGE DES FILMS
- //------------------------------------------------------------------------------
-
- procedure AnalyzePage(Address, Params: string);
- var
- Line, aucun_film,page_film,titre_film, la_page : string;
- BeginPos, EndPos, compteur: Integer;
-
- begin
- //vide la liste des films
- PickTreeClear;
-
- //charge la page
- Address := URLEncode(Address);
- Params := URLEncode(Params);
- Line := PostPage(Address,Params);
- aucun_film := Line;
-
- //teste si il y a des films trouvΘs
- BeginPos := Pos('<tr><td colspan="3" align="center"><b>RΘsultats sur les titres</b><br><br></td></tr>', aucun_film);
- if BeginPos <> 0 then
- begin
- Delete(aucun_film, 1, BeginPos);
- BeginPos := Pos('<tr><td colspan=3 align=center>Aucun rΘsultat α votre recherche</td></tr>', aucun_film);
- if BeginPos <> 0 then
- begin
- titre_film := MovieName;
- titre_film := Trim(titre_film);
- titre_film := AnsiLowerCase(titre_film);
- titre_film := AnsiUpFirstLetter(titre_film);
- showmessage('Aucune erreur trouvΘe pour : ' + titre_film);
- exit;
- end;
- end;
-
- //introduction rΘsultats
- titre_film := MovieName;
- titre_film := AnsiUpFirstLetter(titre_film);
- PickTreeAdd('Erreurs trouvΘes pour le film ' + titre_film + ' :', '');
-
- //compte les rΘsultats
- compteur := 0;
-
- BeginPos := Pos('<td>Titre</td>', Line);
- Delete(Line, 1, BeginPos+14);
-
- //cherche le lien de la page du film
- BeginPos := Pos('<td><a href=', Line);
-
- repeat
- Delete(Line, 1, BeginPos+12);
- EndPos := Pos('>', Line);
- page_film := 'http://www.erreursdefilms.com/' + Copy(Line, 1, EndPos-2 );
- page_film := URLEncode(page_film);
- //cherche le nom du film
- BeginPos := Pos('>',Line);
- Delete(Line, 1, BeginPos);
- EndPos := Pos('</a></td>',Line);
- titre_film := Copy(Line, 1, EndPos-1 );
- HTMLdecode(titre_film);
- HTMLremovetags(titre_film);
- titre_film := Trim(titre_film);
- titre_film := AnsiLowerCase(titre_film);
- titre_film := AnsiUpFirstLetter(titre_film);
- if titre_film <> '' then
- begin
- //ajoute les films
- PickTreeAdd(titre_film , page_film);
- la_page := page_film;
- compteur := compteur+1;
- end;
- //cherche le lien de la page du film
- BeginPos := Pos('<td><a href=', Line);
- until BeginPos = 0;
-
- if compteur = 1 then
- begin
- AnalysePageFilm(la_page);
- exit;
- end;
-
- PickTreeAdd(' ', '');
- PickTreeAdd('Verifier si vous avez la derniΦre version', 'version');
-
- begin
- if PickTreeExec(Address)=true then
- begin
- if (Address = 'version') then
- begin
- verifVersion();
- end else
- begin
- AnalysePageFilm(Address);
- end;
- end;
- end;
- end;
-
- //------------------------------------------------------------------------------
- // VERIFIER LA VERSION DU SCRIPT
- //------------------------------------------------------------------------------
-
- procedure verifVersion();
- var
- Line, NewVersion, MaVersion, Telecharge : String;
- BeginPos, EndPos : Integer;
- begin
- MaVersion := '7';
- Line := GetPage('http://forum.antp.be/phpbb2/viewtopic.php?t=1453');
- BeginPos := pos('TELECHARGER LE SCRIPT ERREURS DE FILMS v', Line);
- delete(Line,1, BeginPos+39);
- EndPos := pos('du', Line);
- NewVersion := copy(Line, 1, EndPos - 2);
- PickTreeClear;
- PickTreeAdd('Votre version est la '+MaVersion+', la derniΦre est la '+NewVersion+'.', '');
- PickTreeAdd('Pour tΘlΘcharger la derniΦre version :', '');
- PickTreeAdd('Cliquez ici', 'DL');
- PickTreeAdd('Le script sera tΘlΘcharger dans le mΩme rΘpertoire que votre catalogue', '');
- PickTreeAdd('Cliquez sur annuler pour quitter', '');
- begin
- if PickTreeExec(Telecharge)=true then
- if (Telecharge = 'DL') then
- begin
- GetPicture('http://www.ifrance.com/ricoland/Erreurs%20de%20films%20(FR).ifs', True);
- end else
- begin
- exit;
- end;
- end;
- end;
-
- //------------------------------------------------------------------------------
- // ANALYSE DE LA PAGE DU FILM
- //------------------------------------------------------------------------------
-
- procedure AnalysePageFilm(Address: string);
- var
- Line,les_erreurs, erreur, detail_erreur : string;
- BeginPos, EndPos: Integer;
-
- begin
- //charge la page
- Address := URLEncode(Address);
- Line := GetPage(Address);
-
- les_erreurs := 'Liste des erreurs :';
-
- //cherche les erreurs
- BeginPos := Pos('<td width=''*'' valign=''top''>', Line);
- if BeginPos <> 0 then
- begin
- repeat
- Delete(Line, 1, BeginPos+26);
- BeginPos := Pos('<b>', Line);
- Delete(Line, 1, BeginPos+2);
- EndPos := Pos('</b><br>', Line);
- //type d'erreur
- erreur := copy(Line,1,EndPos-1);
- erreur := StringReplace(erreur , #13#10, ' ');
- erreur := #13#10#13#10 + erreur + #13#10;
- Delete(Line, 1, EndPos+7);
- EndPos := Pos('</b><br>', Line);
- //l'erreur en dΘtail
- detail_erreur := copy(Line,1,EndPos-1);
- detail_erreur := StringReplace(detail_erreur , #13#10, ' ');
- detail_erreur := Trim(detail_erreur);
- erreur := erreur + detail_erreur + ' -';
- erreur := StringReplace(erreur , '<br> <b>', ' - ');
- erreur := StringReplace(erreur , ' ', '');
- erreur := Trim(erreur);
- les_erreurs := les_erreurs + erreur;
- BeginPos := Pos('<td width=''*'' valign=''top''>', Line);
- until BeginPos = 0;
- end;
-
- les_erreurs := les_erreurs + #13#10#13#10 + 'Informations provenant du site www.erreursdefilms.com';
-
- //charge les rΘsultats dans la fenΩtre
- SetField( fieldOriginalTitle,GetField(fieldOriginalTitle));
- SetField( fieldTranslatedTitle,GetField(fieldTranslatedTitle));
- if (GetField(fieldComments) <> '') then
- begin
- les_erreurs := GetField(fieldComments)+ #13#10#13#10 + les_erreurs;
- SetField( fieldComments,les_erreurs);
- end else
- begin
- SetField( fieldComments,les_erreurs);
- end;
- DisplayResults;
- end;
-
- //------------------------------------------------------------------------------
- // PROCEDURE DE DEBUG AVEC ECRITURE DANS UN FICHIER
- //------------------------------------------------------------------------------
-
- procedure debug (la_ligne : String);
- var
- Page: TStringList;
- LineNr: Integer;
- fichier: string;
- begin
- fichier := 'D:\Mes documents\dossier personnel\temp\DEBUG.HTM';
- Page := TStringList.Create;
- Page.Text := la_ligne;
- Page.SaveToFile(fichier);
- end;
-
- //------------------------------------------------------------------------------
- // NETTOIE LE TITRE DU FICHIER POUR AVOIR LE TITRE DE FILM
- //------------------------------------------------------------------------------
-
- function cleanTitle(title : String) : string;
- var
- i,j, fin : Integer;
- temp : String;
-
- begin
- title := AnsiUpperCase(title);
-
- if title <> '' then
- begin
- // Nettoie les tags fichiers, merci Atmosfear pour les tags
- i:=pos('.DVD',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.DIVX',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.FREN',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.GERM',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.INT',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.LIM',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.PROP',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.REPACK',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.SUBB',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.UNSUB',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.WS',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.XVID',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.AC3',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
- i:=pos('.UNRAT',title);
- if i <> 0 then
- begin
- title := copy(title,1,i-1);
- end;
-
- title := StringReplace(title, '.', ' ');
- title := StringReplace(title, ',', ' ');
- title := StringReplace(title, ':', '');
- title := StringReplace(title, '-', '');
- title := StringReplace(title, ' ', ' ');
-
- i := 0;
- // Nettoie les tags de team
- if (pos('(',title) <> 0) then
- begin
- i := pos('(',title);
- temp := copy(title,0,i-1);
- j := pos(')',title);
- fin := Length(title);
- title := temp + copy(title,j+1,fin);
- end;
-
- if (pos('[',title) <> 0) then
- begin
- i := pos('[',title);
- temp := copy(title,1,i-1);
- j := pos(']',title);
- fin := Length(title);
- title := temp + copy(title,j+1,fin);
- end;
-
- title := AnsiLowerCase(title);
- title := AnsiUpFirstLetter(title);
- title := AnsiMixedCase(title,' -');
- end;
- result := title;
- end;
-
- //------------------------------------------------------------------------------
- // PROGRAMME PRINCIPAL
- //------------------------------------------------------------------------------
-
- begin
- if CheckVersion(3,4,0) then
- begin
- MovieName := GetField(fieldTranslatedTitle);
- if MovieName = '' then
- MovieName := GetField(fieldOriginalTitle);
- MovieName := cleanTitle(MovieName);
- if (ConfirmTitre = True) then
- begin
- if Input('Erreurs de Films by ScorEpioN', 'Entrez le titre du film :', MovieName) then
- begin
- //remplace les caractΦres accentuΘs
- NomFilm := MovieName;
- NomFilm := AnsiLowerCase(NomFilm);
- NomFilm := StringReplace(NomFilm, 'Θ', 'e');
- NomFilm := StringReplace(NomFilm, 'Φ', 'e');
- NomFilm := StringReplace(NomFilm, 'α', 'a');
- NomFilm := StringReplace(NomFilm, 'τ', 'c');
- NomFilm := StringReplace(NomFilm, '∙', 'u');
- Adresse := URLEncode('http://www.erreursdefilms.com/resrech.php');
- Parametre := URLEncode('rechtxt='+NomFilm+'&typerech=tous');
- AnalyzePage(Adresse, Parametre);
- end;
- end else
- begin
- NomFilm := MovieName;
- NomFilm := AnsiLowerCase(NomFilm);
- NomFilm := StringReplace(NomFilm, 'Θ', 'e');
- NomFilm := StringReplace(NomFilm, 'Φ', 'e');
- NomFilm := StringReplace(NomFilm, 'α', 'a');
- NomFilm := StringReplace(NomFilm, 'τ', 'c');
- NomFilm := StringReplace(NomFilm, '∙', 'u');
- Adresse := URLEncode('http://www.erreursdefilms.com/resrech.php');
- Parametre := URLEncode('rechtxt='+NomFilm+'&typerech=tous');
- if (premiereExecution = 0) then
- begin
- premiereExecution := -1;
- PickTreeClear;
- PickTreeAdd('Vous allez executer le script Erreurs de films sans confirmation', '');
- PickTreeAdd('Cliquez ici pour continuer', 'Oui');
- PickTreeAdd('Cliquez sur annuler pour ne pas executer le script', '');
- begin
- if PickTreeExec(Reponse)=true then
- if (Reponse = 'Oui') then
- begin
- AnalyzePage(Adresse, Parametre);
- end;
- end;
- end else
- begin
- AnalyzePage(Adresse, Parametre);
- end;
- end;
- end else
- ShowMessage('Ce script requiert une version plus rΘcente de Ant Movie Catalog (au moins la version 3.4.0)');
- end.
-